From cefb1d061eb0194c4ca39911b227bd99026b62aa Mon Sep 17 00:00:00 2001 From: Jyrki Gadinger Date: Thu, 3 Apr 2025 11:52:17 +0200 Subject: [PATCH] fix(gui): remove ignored file notifications from Activity list These are informative notifications without any need/possibility to act on immediately -- if a file is not synced it will be visible from the shell integration anyway. An eventual follow-up to this change would be to have a dialogue with an overview of all files that were ignored (including the entry in the ignore list that caused a specific file to be ignored). Closes #6712 Signed-off-by: Jyrki Gadinger --- src/gui/tray/activitylistmodel.cpp | 25 ------------------------- src/gui/tray/activitylistmodel.h | 1 - src/gui/tray/usermodel.cpp | 4 +--- test/testactivitylistmodel.cpp | 11 +---------- test/testsortedactivitylistmodel.cpp | 13 ------------- 5 files changed, 2 insertions(+), 52 deletions(-) diff --git a/src/gui/tray/activitylistmodel.cpp b/src/gui/tray/activitylistmodel.cpp index 68f101a0f..b39b354c4 100644 --- a/src/gui/tray/activitylistmodel.cpp +++ b/src/gui/tray/activitylistmodel.cpp @@ -597,31 +597,6 @@ void ActivityListModel::addErrorToActivityList(const Activity &activity, const E } } -void ActivityListModel::addIgnoredFileToList(const Activity &newActivity) -{ - qCInfo(lcActivity) << "First checking for duplicates then add file to the notification list of ignored files: " << newActivity._file; - - bool duplicate = false; - if (_listOfIgnoredFiles.size() == 0) { - _notificationIgnoredFiles = newActivity; - _notificationIgnoredFiles._subject = tr("Files from the ignore list as well as symbolic links are not synced."); - addEntriesToActivityList({_notificationIgnoredFiles}); - _listOfIgnoredFiles.append(newActivity); - return; - } - - for (const auto &activity : _listOfIgnoredFiles) { - if (activity._file == newActivity._file) { - duplicate = true; - break; - } - } - - if (!duplicate) { - _notificationIgnoredFiles._message.append(", " + newActivity._file); - } -} - void ActivityListModel::addNotificationToActivityList(const Activity &activity) { qCDebug(lcActivity) << "Notification successfully added to the notification list: " << activity._subject; diff --git a/src/gui/tray/activitylistmodel.h b/src/gui/tray/activitylistmodel.h index c00707876..0ac9af94d 100644 --- a/src/gui/tray/activitylistmodel.h +++ b/src/gui/tray/activitylistmodel.h @@ -131,7 +131,6 @@ public slots: void addNotificationToActivityList(const OCC::Activity &activity); void addErrorToActivityList(const OCC::Activity &activity, const OCC::ActivityListModel::ErrorType type); - void addIgnoredFileToList(const OCC::Activity &newActivity); void addSyncFileItemToActivityList(const OCC::Activity &activity); void removeActivityFromActivityList(int row); void removeActivityFromActivityList(const OCC::Activity &activity); diff --git a/src/gui/tray/usermodel.cpp b/src/gui/tray/usermodel.cpp index 6cb075b63..5316528c7 100644 --- a/src/gui/tray/usermodel.cpp +++ b/src/gui/tray/usermodel.cpp @@ -869,9 +869,7 @@ void User::processCompletedSyncItem(const Folder *folder, const SyncFileItemPtr activity._subject = item->_errorString; activity._id = -static_cast(qHash(activity._subject + activity._message)); - if (item->_status == SyncFileItem::Status::FileIgnored) { - _activityModel->addIgnoredFileToList(activity); - } else { + if (item->_status != SyncFileItem::Status::FileIgnored) { // add 'protocol error' to activity list if (item->_status == SyncFileItem::Status::FileNameInvalid || item->_status == SyncFileItem::Status::FileNameInvalidOnServer) { ActivityLink buttonActivityLink; diff --git a/test/testactivitylistmodel.cpp b/test/testactivitylistmodel.cpp index 84277356b..6e96880f2 100644 --- a/test/testactivitylistmodel.cpp +++ b/test/testactivitylistmodel.cpp @@ -41,7 +41,6 @@ public: OCC::Activity testNotificationActivity; OCC::Activity testSyncResultErrorActivity; OCC::Activity testSyncFileItemActivity; - OCC::Activity testFileIgnoredActivity; static constexpr int searchResultsReplyDelay = 100; @@ -119,7 +118,6 @@ private slots: testNotificationActivity = exampleNotificationActivity(accName); testSyncResultErrorActivity = exampleSyncResultErrorActivity(accName); testSyncFileItemActivity = exampleSyncFileItemActivity(accName, accUrl); - testFileIgnoredActivity = exampleFileIgnoredActivity(accName, accUrl); }; // Test receiving activity from server @@ -147,10 +145,6 @@ private slots: testActivityAdd(&TestingALM::addErrorToActivityList, testSyncResultErrorActivity, OCC::ActivityListModel::ErrorType::SyncError); }; - void testAddIgnoredFile() { - testActivityAdd(&TestingALM::addIgnoredFileToList, testFileIgnoredActivity); - }; - // Test removing activity from list void testRemoveActivityWithRow() { const auto model = testingALM(); @@ -207,11 +201,8 @@ private slots: model->addErrorToActivityList(testSyncResultErrorActivity, OCC::ActivityListModel::ErrorType::SyncError); QCOMPARE(model->rowCount(), 52); - model->addIgnoredFileToList(testFileIgnoredActivity); - QCOMPARE(model->rowCount(), 53); - model->addNotificationToActivityList(testNotificationActivity); - QCOMPARE(model->rowCount(), 54); + QCOMPARE(model->rowCount(), 53); // Test all rows for things in common for (int i = 0; i < model->rowCount(); i++) { diff --git a/test/testsortedactivitylistmodel.cpp b/test/testsortedactivitylistmodel.cpp index 7e6d40e99..68e960410 100644 --- a/test/testsortedactivitylistmodel.cpp +++ b/test/testsortedactivitylistmodel.cpp @@ -42,7 +42,6 @@ public: OCC::Activity testNotificationActivity; OCC::Activity testSyncResultErrorActivity; OCC::Activity testSyncFileItemActivity; - OCC::Activity testFileIgnoredActivity; QSharedPointer testingSortedALM() { @@ -114,7 +113,6 @@ private slots: testNotificationActivity = exampleNotificationActivity(accName); testSyncResultErrorActivity = exampleSyncResultErrorActivity(accName); testSyncFileItemActivity = exampleSyncFileItemActivity(accName, accUrl); - testFileIgnoredActivity = exampleFileIgnoredActivity(accName, accUrl); }; void testMatchingRowCounts() @@ -146,7 +144,6 @@ private slots: addActivity(model, &TestingALM::addSyncFileItemToActivityList, testSyncFileItemActivity); addActivity(model, &TestingALM::addNotificationToActivityList, testNotificationActivity); addActivity(model, &TestingALM::addErrorToActivityList, testSyncResultErrorActivity, OCC::ActivityListModel::ErrorType::SyncError); - addActivity(model, &TestingALM::addIgnoredFileToList, testFileIgnoredActivity); } void testSort() @@ -168,7 +165,6 @@ private slots: addActivity(model, &TestingALM::addSyncFileItemToActivityList, testSyncFileItemActivity); addActivity(model, &TestingALM::addNotificationToActivityList, testNotificationActivity); addActivity(model, &TestingALM::addErrorToActivityList, testSyncResultErrorActivity, OCC::ActivityListModel::ErrorType::SyncError); - addActivity(model, &TestingALM::addIgnoredFileToList, testFileIgnoredActivity); // first let's go through priority activities (interactive ones and those with _fileAction == "security" auto i = 0; @@ -207,15 +203,6 @@ private slots: } lasIndex = i; - // now, let's check if activity is an ignored file - for (; i < lasIndex + 1 && i < model->rowCount(); ++i) { - const auto index = model->index(i, 0); - const auto activity = index.data(OCC::ActivityListModel::ActivityRole).value(); - QCOMPARE(activity._type, OCC::Activity::SyncFileItemType); - QCOMPARE(activity._syncFileItemStatus, OCC::SyncFileItem::FileIgnored); - } - lasIndex = i; - const QVector activityDefaultTypeOrder{OCC::Activity::DummyFetchingActivityType, OCC::Activity::SyncResultType, OCC::Activity::NotificationType, -- 2.30.2